import com.itheima.ssm.dao.UsersMapper;
import com.itheima.ssm.service.impl.ToolSpring;
import com.itheima.ssm.vo.Users;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations =
{ "classpath:applicationContext.xml","classpath:heimadao.spring.xml" })
public class BaseTestCase
{
    @Autowired
    private UsersMapper usersMapper;



    @Test
    public void testUser ()
    {
        ApplicationContext applicationContext = ToolSpring.getApplicationContext();
        /*Users users = null;
        try {
            users = usersMapper.selectByPrimaryKey(1);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        }*/

        Users tom = null;
        try {
            tom = usersMapper.findByUsername("tom");
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        }
        System.out.println(tom);
    }
}
